/**
 * Created by chengming on 18/5/27.
 * version 1.0
 */
const BaseJsonAdapter = require('../base/BaseJsonAdapter');
const iconv = require("iconv-lite");

/**
 * 北京互金网
 * @type {module.Bjp2p}
 */
module.exports = class AppTJYun extends BaseJsonAdapter{

    async reqJson(){
		    const body = await this.doRequest();
        let decodeBody = iconv.decode(body, this.encoding).toString();
        let start = decodeBody.indexOf('var json = ')+'var json = '.length
        let end = decodeBody.indexOf('}];', start)
        decodeBody = decodeBody.substring(start,end) + '}]';
        let data = JSON.parse(decodeBody);
		    return {data:data};
	  }
}
